package com.lzy.cloud.base.facade;

import com.github.pagehelper.PageInfo;
import com.lzy.cloud.base.dto.ProtocolDto;
import com.lzy.cloud.base.service.ProtocolService;
import com.lzy.framework.core.ensure.Ensure;
import com.lzy.framework.core.orm.db.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 协议
 *
 * @author lc
 * @version 2018/8/17
 */
@Component
public class ProtocolFacade {

    @Autowired
    private ProtocolService protocolService;

    /**
     * 新增协议
     * @param dto
     * @return
     */
    public Long create(ProtocolDto dto) {
        Long id = protocolService.create(dto);
        return id;
    }

    /**
     * 分页查询
     * @param pager
     * @param map
     * @return
     */
    public PageInfo<ProtocolDto> selectList(Pager pager, ProtocolDto map) {
        return protocolService.selectList(pager,map);
    }

    /**
     * 修改
     * @param map
     * @return
     */
    public Boolean update(ProtocolDto map) {
        Ensure.that(map.getId()).isNotNull("00000002");
        return protocolService.update(map);
    }
}
